<extend name="Public:common"/>
<block name="css">
    <link rel="stylesheet" href="__STATIC__/layui/css/layui.css"  media="all">
    <style>
        th{text-align:center;}
    </style>
</block>
<block name="content">
    <div class="page-header"><h1><i class="fa fa-home"></i> 首页>产品管理>线路管理</h1></div>
     <div class="container-fluid">
         <div class="tabbable">
             <ul class="nav nav-tabs padding-12 tab-color-blue background-blue" id="myTab">
                 <li <if condition="$post['status'] eq 1">class="active"</if> ><a href="javascript:checkStatus(1);" >已上架</a></li>
                 <li <if condition="$post['status'] eq 0">class="active"</if>><a href="javascript:checkStatus(0);" >待审核
                     <if condition="$waitAudit">
                         <span class="badge">{$waitAudit}</span>
                     </if>
                    </a></li>
                 <li <if condition="$post['status'] eq -2">class="active"</if>><a href="javascript:checkStatus(-2);" >被拒线路</a></li>
                 <li <if condition="$post['status'] eq -1">class="active"</if>><a href="javascript:checkStatus(-1);" >下架线路</a></li>
                 <li <if condition="$post['status'] eq -4">class="active"</if>><a href="javascript:checkStatus(-4);" >过期线路</a></li>

             </ul>
             <div class="tab-content">
                 <div class="row" >
                     <form action="lineList" class="form-inline " method="get" style="margin-left:10px;" >
                         <input type="hidden" name="status" value="{$post.status|default=0}" style="display: none;">
                         <div class="form-group">
                             <label for="lineNum">线路编号</label>
                             <input type="text" class="" name="line_sn" id="line_sn" placeholder="线路编号" value="{$post.line_sn}">
                         </div>
                         <div class="form-group">
                             <label for="lineName">线路名称</label>
                             <input type="text" class="" name="line_name" id="line_name" placeholder="线路名称" value="{$post.line_name}">
                         </div>
                         <div class="form-group">
                             <label for="lineName">团号</label>
                             <input type="text" class="" name="group_num" id="group_num" placeholder="团号" value="{$post.group_num}">
                         </div>

                         <div class="form-group">
                             <label for="lineName">出发地</label>
                             <input type="text" class="" name="area_name" id="area_name" placeholder="出发地" value="{$post.area_name}">
                         </div>
                         <div class="form-group">
                             <label for="lineName">运营性质</label>
                             <select name="source_type" id="source_type">
                                 <option value="">全部</option>
                                 <option <if condition="$post['source_type'] eq 1">selected</if> value="1">自营</option>
                                 <option  <if condition="$post['source_type'] eq 2">selected</if>  value="2">专线</option>
                             </select>
                         </div>


                         <!--
                           <div class="form-group">
                             <label for="pushDepartment">发布部门</label>
                             <input type="text" class="" name="department" id="department" placeholder="发布部门" value="{$post.department}">
                         </div>
                         <div class="form-group">
                             <label for="startDate">发布时间</label>
                             <input type="text" class="" name="start_time" id="start_time" placeholder="开始时间" value="{$post.start_time}" readonly>
                         </div>
                         <div class="form-group">
                             <label for="endDate">&nbsp;</label>
                             <input type="text" class="" name="end_time" id="end_time" placeholder="结束时间" value="{$post.end_time}" readonly>
                         </div>-->
                         <button type="submit" class="btn btn-primary">查询</button>
                     </form>
                 </div>

                 <table class="table table-striped table-bordered table-hover table-condensed text-center">
                     <tbody>
                         <tr>
                             <th>全选 <input type="checkbox" class="checkAll"></th>
                             <th>线路编号</th>
                             <th>线路名称</th>
                             <th>团号</th>
                             <th>行程天数</th>
                             <th>出发地</th>
                             <th>发布时间</th>
                             <th>供应商</th>
                            <!-- <th>结算价格</th>-->
                             <th>状态</th>
                             <th>审核人</th>
                             <th>操作</th>
                         </tr>
                         <volist name="list" id="vo">
                         <tr>
                             <td><input type="checkbox" class="chk" value=""></td>
                             <td>{$vo.line_sn}</td>
                             <td>{$vo.line_name}</td>
                             <td>{$vo.group_num}</td>
                             <td>{$vo.travel_days}</td>
                             <td>{$vo.areaName}</td>
                             <td> {$vo.create_time|date="Y-m-d",###}</td>
                             <td> {$vo.supplier_name|default="无"}</td>
                            <!-- <td>
                                 <if condition="$vo['adult_money'] gt 0">
                                     成{$vo.adult_money};成{$vo.child_money};成{$vo.oldman_money}
                                 </if>
                             </td>-->
                             <td>
                                 <switch name="vo.line_status">
                                     <case value="1">已上架</case>
                                     <case value="0">待审核</case>
                                     <case value="-1">已下架</case>
                                     <case value="-2">已拒绝</case>
                                 </switch>
                             </td>
                             <td>{$vo.operator_name}</td>
                             <td>

                                 <if condition="$vo['source_type'] eq 1">
                                     <if condition="checkAuth('Operator/Product/lineDetail')">
                                     <a href="{:U('lineDetail',array('id'=>$vo['line_id']))}" class="btn btn-xs btn-primary">详情</a>
                                     </if>
                                        <else/>
                                     <if condition="checkAuth('Operator/Product/specialLineDetail')">
                                     <a href="{:U('specialLineDetail',array('id'=>$vo['line_id']))}" class="btn btn-xs btn-primary">详情</a>
                                     </if>
                                 </if>


                                 <switch name="vo.line_status">
                                     <case value="1">
                                         <if condition="checkAuth('Operator/Product/soldOut')">
                                             <a href="{:U('soldOut',array('id'=>$vo['line_id']))}" class="btn btn-xs btn-primary">下架</a>
                                         </if>

                                     </case>
                                     <case value="0">

                                             <if condition="$vo['source_type'] eq 1">
                                                 <if condition="checkAuth('Operator/Product/auditLine')">
                                                    <a href="{:U('auditLine',array('id'=>$vo['line_id']))}" class="btn btn-xs btn-primary">审核</a>
                                                 </if>
                                                 <else/>
                                                 <if condition="checkAuth('Operator/Product/auditSpecialLine')">
                                                 <a href="{:U('auditSpecialLine',array('id'=>$vo['line_id']))}" class="btn btn-xs btn-primary">审核</a>
                                                 </if>
                                             </if>

                                     </case>
                                     <case value="-2">


                                             <if condition="$vo['source_type'] eq 1">
                                                 <if condition="checkAuth('Operator/EditLine/form_step1')">
                                                    <a href="{:U('EditLine/form_step1',array('id'=>$vo['line_id']))}" class="btn btn-xs btn-primary">编辑</a>
                                                 </if>
                                                 <else/>
                                                 <!--供应商提供的专线路-->
                                                 <if condition="checkAuth('Operator/SpecialLine/form_step1')">
                                                 <a href="{:U('SpecialLine/form_step1',array('id'=>$vo['line_id']))}" class="btn btn-xs btn-primary">编辑</a>
                                                 </if>
                                             </if>


                                     </case>
                                     <case value="-1">
                                         <if condition="checkAuth('Operator/Product/putaway')">
                                             <a href="{:U('putaway',array('id'=>$vo['line_id']))}" class="btn btn-xs btn-primary">上架</a>
                                         </if>
                                     </case>
                                 </switch>
                             </td>
                         </tr>
                         </volist>
                            <tr>
                                <td colspan="12">
                                    <ul class="pagination">
                                        {$show}
                                    </ul>
                                </td>
                            </tr>
                     </tbody>
                 </table>
             </div>
         </div>
     </div>
</block>
<block name="js">
    <script src="__STATIC__/layui/layui.all.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>

    <script>
        function checkStatus(status) {
            $('input[name="status"]').val(status);
            $('form').submit();
        }

        layui.use('laydate', function() {
            var laydate = layui.laydate;
            //常规用法
            laydate.render({
                elem: '#start_time'
            });
            laydate.render({
                elem: '#end_time'
            });
        });


    </script>
</block>